package com.infoauto.opc.gateway.controller;

import com.infoauto.opc.gateway.entity.Result;
import com.infoauto.opc.gateway.entity.ResultCode;
import com.infoauto.opc.gateway.model.gtm4.ControlSignalStation;
import com.infoauto.opc.gateway.model.gtm4.Equipment;
import com.infoauto.opc.gateway.service.ControlSignalStationService;
import com.infoauto.opc.gateway.service.EquipmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 设备基础数据
 */

@CrossOrigin
@RestController
@RequestMapping("/equipment")
public class EquipmentController {
    @Autowired
    private EquipmentService service;

    /**
     * 根据厂家查询设备
     * @param equipmentCompanyId
     * @return
     */
    @RequestMapping(value="/slelctByEcId" ,method= RequestMethod.GET)
    public Result slelctByEquipmentCompanyId(Integer equipmentCompanyId){
        try{
            List<Equipment> list = service.slelctByEquipmentCompanyId(equipmentCompanyId);
            return new Result(ResultCode.SUCCESS,list);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

}
